rolesystem.roles
Class KnownEvent

java.lang.Object
  extended by rolesystem.roles.KnownEvent

public class KnownEvent
extends java.lang.Object

This class represents a known event, wich describes a kind of event expected for a role. A role includes several objects of this class, declared as "static final", one for each kind of expected event. Instances of this class are constant, once created they cannot be changed. A method is provided to check whether a RoleEvent and an instance of this class match.


Constructor Summary
KnownEvent(java.lang.String name, java.lang.String senderRole)
          Constructs a known event with no informative content expected.
KnownEvent(java.lang.String name, java.lang.String senderRole, java.lang.Class contentClass)
           
 
Method Summary
 java.lang.Class getContentClass()
          Returns the class expected for the informative content of the event.
 java.lang.String getName()
          Returns the expected for the event.
 java.lang.String getSenderRole()
          Returns the role expected for the sender of the event.
 boolean match(RoleEvent event)
          Check whether this KnownEvent and a specified RoleEvent match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KnownEvent

public KnownEvent(java.lang.String name,
                  java.lang.String senderRole,
                  java.lang.Class contentClass)
Parameters:
name - Name expected for the event.
senderRole - Role expected for the sender of the event.
contentClass - Class expected for the informative content of the event; if no informative content is expected for the event, it must be null.

KnownEvent

public KnownEvent(java.lang.String name,
                  java.lang.String senderRole)
Constructs a known event with no informative content expected.

Parameters:
name - Name expected for the event.
senderRole - Role expected for the sender of the event.
Method Detail

getName

public java.lang.String getName()
Returns the expected for the event.

Returns:
The expected for the event.

getSenderRole

public java.lang.String getSenderRole()
Returns the role expected for the sender of the event.

Returns:
The role expected for the sender of the event.

getContentClass

public java.lang.Class getContentClass()
Returns the class expected for the informative content of the event.

Returns:
The class expected for the informative content of the event, or null if no informative content is expected for the event.

match

public boolean match(RoleEvent event)
Check whether this KnownEvent and a specified RoleEvent match.

Parameters:
event - Instance of RoleEvent to check.
Returns:
true if this KnownEvent and the specified RoleEvent match.